{% extends 'index.html' %}
{% block content %}
 <div class="breadcrumbs">
        <div class="breadcrumbs-inner">
            <div class="row m-0">
                <div class="col-sm-4">
                    <div class="page-header float-left">
                        <div class="page-title">
                           <h1>京乳时鲜 &emsp;&emsp;&emsp;仓库号&emsp;&emsp;{{warehouseID}}</h1>
                        </div>
                    </div>
                </div>
                <div class="col-sm-8">
                    <div class="page-header float-right">
                        <div class="page-title">
                            <ol class="breadcrumb text-right">
                                <li><a href="{% url 'index' %}">主页</a></li>
                                <li class="active">采购单生成</li>
                            </ol>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="content">
        <div class="row">
            <div class="col-lg-12">
                <div class="card">
                    <div class="card-header">
                        <h4>需求表处理&emsp;&emsp;需求单号&emsp;{{demandID }}</h4>
                    </div>
                    <div class="card-body">
                        <div class="tab-pane fade show active" id="pills-seg" role="tabpanel" aria-labelledby="pills-seg-tab">
                            <div class="card-header">商品需求单{{order.number}}</div>
                            <form method="POST">
                                <div class="table-stats order-table ov-h" style="width: 60%; float:left; display: inline-block">
                                    {% csrf_token %}
                                    <table class="table">
                                        <thead>
                                            <tr>
                                                <th class="avatar">商品ID</th>
                                                <th>商品名称</th>
                                                <th>库存数量</th>
                                                <th>推荐采购数量</th>
                                                <th>实际采购数量</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            {% for i in d_demand %}
                                            <tr>
                                                <td> {{i.product.p_ID}} </td>
                                                <td>{{ i.product.p_name }}</td>
                                                <td> <span class="product">{{i.remain}}</span> </td>
                                                <td>{{i.quantity}}</td>
                                                <td style="width:15%">
                                                    <input value="0" name="number{{ forloop.counter }}" type="text" class="form-control" required="required" width="10%"/>
                                                </td>
                                            </tr>
                                            {% endfor %}
                                        </tbody>
                                    </table>
                                </div> <!-- /.table-stats -->
                                <br/>
                                    <div class="card-text text-sm-center">
                                         <input value="更新需求单" type="submit" class="btn btn-primary" />
                                    <br/><br/>
                                         <a href="{% url 'demand2purchase' demandID %}" class="btn btn-primary" style="height:10%">生成采购订单</a>
                                    </div>
									</form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
<script>
    jQuery(document).ready(function ($) {
        $("#purchase").addClass("active");
        $('#purchase_info').addClass("active");
    })
</script>
{% endblock %}